/**
 * Created by baiguiren on 1/16/17.
 */

let async = require('async');

let test_arr = [1, 2, 3, 4, 5];

async.sortBy(test_arr, (item, callback) => {
  setTimeout(() => {
    callback(null, item);
  }, Math.random() * 100);
}, (err, results) => {
  console.log(err ? err : results);
});

async.sortBy(test_arr, (item, callback) => {
  setTimeout(() => {
    callback(null, item * -1);
  }, Math.random() * 100);
}, (err, results) => {
  console.log(err ? err : results);
});
